function excludeTrial = exclude_problem_trial(static,yaw,pitch)
%EXCLUDE_PROBLEM_TRIAL 排除掉有问题的试次数据
%---input---
%static：静止数据，第一个维度为session，第二个维度为stimulus，第三个维度为trial，第四个维度为channel，第五个维度为samplepoints
%yaw：偏航数据，数据格式同上
%pitch：俯仰数据，数据格式同上
f = figure;
excludei = 1;
excludeTrial = [];
for stimulus = 1:4
    for condition = 1:3
        switch condition
            case 1
                SSVEPdata = static;
            case 2
                SSVEPdata = yaw;
            case 3
                SSVEPdata = pitch;
        end
        for session = 1:size(SSVEPdata,1)
            for trial = 1:size(SSVEPdata,3)
                last_key = '';
                epoch = SSVEPdata(session,stimulus,trial,:,:);
                epoch = reshape(epoch,size(SSVEPdata,4),size(SSVEPdata,5));
                plot(epoch');
                % f接受，j拒绝
                while(~(strcmp(last_key,'f') || strcmp(last_key,'j')))
                    waitforbuttonpress;
                    last_key = f.CurrentCharacter;
                end
                if(strcmp(last_key,'j'))
                    excludeTrial(excludei,:) = [stimulus condition session trial];
                    excludei = excludei + 1;
                    disp(['Stimulus: ',num2str(stimulus),' Condition: ',num2str(condition),' Session: ',num2str(session),' Trial: ',num2str(trial),...
                        ' REJECTED']);
                else
                    disp(['Stimulus: ',num2str(stimulus),' Condition: ',num2str(condition),' Session: ',num2str(session),' Trial: ',num2str(trial),...
                    ' ACCEPTED']);
                end
                clf;
            end %trial
        end %session
    end %condition
end %stimulus
end

